import Vue from 'vue'
import App from './App.vue'
import router from './router/router'
import './assets/gobal.css'
import './plugins/element'
import './plugins/element.js'
import store from './store'
import './assets/fonts/iconfont.css'
import frpage from './components/commons/fypage.vue'
import comments from './components/commons/comments.vue'
Vue.config.productionTip = false



Vue.component(frpage.name, frpage)
Vue.component(comments.name, comments)

Vue.filter('dateFormat', function (originVal) {
  const dt = new Date(originVal)
  const y = dt.getFullYear()
  const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  const d = (dt.getDate() + '').padStart(2, '0')

  const hh = (dt.getHours() + '').padStart(2, '0')
  const mm = (dt.getMinutes() + '').padStart(2, '0')
  const ss = (dt.getSeconds() + '').padStart(2, '0')

  return `${m}${'月'}${d}${'日'} `
})
Vue.filter('dateFormast', function (time) {
  if(time<0){
    return '00:00'
  }
  let timeData = "";
  let h = Math.floor(time / 60);

  time -= h * 60;

  if (time == 0) {

    if (h < 10) {

      timeData = h ? "0" + h + ":00" : "";

    } else {

      timeData = h ? h + ":00" : "";

    }

  } else {

    if (time < 10) {

      time = "0" + time;

    }

    if (h < 10) {

      h = "0" + h;

    }

    timeData = (h ? h + ":" : "00:00") + (time ? time + "" : "");

  }
  return timeData ||'00:00'
})
Vue.filter('dateFormtt',function(originVal){
  const dt = new Date(originVal)
  const y = dt.getFullYear()
  const m = (dt.getMonth()+1+'').padStart(2,'0')
  const d = (dt.getDate()+'').padStart(2,'0')

  const hh = (dt.getHours()+'').padStart(2,'0')
  const mm = (dt.getMinutes()+'').padStart(2,'0')
  const ss = (dt.getSeconds()+'').padStart(2,'0')

  return `${y}-${m}-${d} `
})
new Vue({
  render: h => h(App),
  beforeCreate() {
    Vue.prototype.$bus = this
  },
  router,
  store,
}).$mount('#app')
